package com.etoak.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;


@Configuration
public class MvcConfig implements WebMvcConfigurer {

    @Value("${file.uploadPath}")
    private  String uploadPath;

    @Value("${file.staticAccessPath}")
    private String staticAccessPath;



    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        //     /pic/**  **任意   123.png  file:D:/upload/pet/123.png

        registry.addResourceHandler(staticAccessPath+"**")
                .addResourceLocations("file:"+uploadPath+"/");
    }
}



